<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<title>查看用户</title>
</head>
<body>

<form action="updateuser" method="post" id="updatekey">
				
				<p>
					<lable>ID:</lable>
					<input type="text" class="layui-input" name="u_id" value="${selectUserById.u_id}">
				
				<p>
				<p>
					<lable>用户名:</lable>
					<input type="text" class="layui-input" name="u_name111" value="${selectUserById.u_name}">
				
				<p>
				<br>
					<lable>密码:</lable>
					<input type="text" class="layui-input" name="u_password" value="${selectUserById.u_password}">
				</p>
				<br>
				<p>
					<lable>性别:</lable>
					<c:if test="${selectUserById.u_gender=='男'}">
					<label>男</label><input type="radio" name="u_gender" value="男" checked="checked">
					<label>女</label><input type="radio" name="u_gender" value="女">
					</c:if>
					<c:if test="${selectUserById.u_gender=='女'}">
					<label>男</label><input type="radio" name="u_gender" value="男">
					<label>女</label><input type="radio" name="u_gender" value="女" checked="checked">
					</c:if>
				</p>
				<br>
				<p>
					<lable>年龄:</lable>
					<input type="text" class="layui-input" name="u_age" value="${selectUserById.u_age}">
				</p>
				<p>
					<lable>电话号码:</lable>
					<input type="text" class="layui-input" name="u_phone" value="${selectUserById.u_phone }">
				</p>
				<p>
					<lable>电子邮件:</lable>
					<input type="text" class="layui-input" name="u_email" value="${selectUserById.u_email}">
				</p>
				<p>
					<lable>个人爱好:</lable>
					<input type="text" class="layui-input" name="u_hobby" value="${selectUserById.u_hobby}">
				</p>
				<p>
					<lable>个人介绍:</lable>				
					 <input type="text" class="layui-input"  name="u_introduction" value="${selectUserById.u_introduction}"> 
				 <!-- <textarea name="u_introduction" placeholder="请输入内容" class="layui-input">${user.u_introduction}</textarea>-->
				</p>
				
				<input type="submit" class="layui-btn" id="reg" lay-submit lay-filter="formDemo"value="修改"  /> 
				<input type="button" class="layui-btn" value="返回"	id="hidebtn">
			</form>

        	
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
	$("#updatekey")
			.submit(
					function() {
						console.log($('input[name="u_gender"]:checked').val())
						$.post("htupdateuser",{
											"u_name" : $('input[name="u_name111"]').val(),
											"u_password" : $('input[name="u_password"]').val(),
											"u_gender" : $('input[name="u_gender"]:checked').val(),
											"u_age" : $('input[name="u_age"]').val(),
											"u_phone" : $('input[name="u_phone"]').val(),
											"u_email" : $('input[name="u_email"]').val(),
											"u_introduction" : $('input[name="u_introduction"]').val(),
											"u_hobby" : $('input[name="u_hobby"]').val(),
											"u_id" : $('input[name="u_id"]').val()
										},
										function(resp) {
											if (resp) {
												alert("修改成功！");
												 window.opener = null;
												    window.open("", "_self");
												    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
													parent.layer.close(index); //再执行关闭
												
											} else {
												alert("修改失败！");
												$('input[name="u_id"]')
														.val("");
												$(
														'input[name="u_password"]')
														.val("");
												$('input[name="u_id"]')
														.focus();
											}
										});
						//阻止表单的默认提交行为
						return false;
					});

})

	

</script>
</html>